package jf.states.graph;

import java.util.HashMap;
import java.util.Map;

import jf.collections.Tuple3;

/**
 * @author ivanalx
 * @date 07.05.2009 12:07:36
 */
public class ConstantExpirationDescription<S,A,D> implements ExpirationDescription<S,A,D> {
	private final Map<S, A> actionsMap;
	private final Map<S, Long> expirationMap;

	public ConstantExpirationDescription(Tuple3<S,Long,A>... config) {
		actionsMap = new HashMap<S,A>();
		expirationMap = new HashMap<S, Long>();
		for (Tuple3<S, Long, A> t : config) {
			actionsMap.put(t._1, t._3);
			expirationMap.put(t._1, t._2);
		}
	}

	public A getActionForExpiredObject(S state) {
		return actionsMap.get(state);
	}

	public Long getTimeForExpireForObject(S state, D o) {
		return expirationMap.get(state);
	}
}
